Changeset a35b458 in mainline for uspace/app/edit/edit.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/edit.c

    r3061bc1 ra35b458  
    8989         */
    9090        int ideal_column;
    91        
     91
    9292        char *previous_search;
    9393        bool previous_search_reverse;
     
    533533                pane.rflags |= REDRAW_TEXT;
    534534        }
    535        
     535
    536536        if (update_ideal_column)
    537537                pane.ideal_column = c_new.column;
    538        
     538
    539539        caret_update();
    540540}
     
    609609        const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
    610610        char *fname;
    611        
     611
    612612        fname = prompt("Save As", old_fname);
    613613        if (fname == NULL) {
     
    816816
    817817        /* Clear the remaining rows if file is short. */
    818        
     818
    819819        int i;
    820820        sysarg_t j;
     
    906906                                console_flush(con);
    907907                        }
    908        
     908
    909909                        if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    910910                                console_flush(con);
     
    912912                                console_flush(con);
    913913                        }
    914        
     914
    915915                        c = str_decode(row_buf, &pos, size);
    916916                        if (c != '\t') {
     
    12181218        coord.row = row;
    12191219        coord.column = column;
    1220        
     1220
    12211221        spt_t pt;
    12221222        sheet_get_cell_pt(doc.sh, &coord, align_dir, &pt);
    1223        
     1223
    12241224        caret_move(pt, select, true);
    12251225}
     
    12631263{
    12641264        char *sline;
    1265        
     1265
    12661266        sline = prompt("Go to line", "");
    12671267        if (sline == NULL) {
     
    12691269                return;
    12701270        }
    1271        
     1271
    12721272        char *endptr;
    12731273        int line = strtol(sline, &endptr, 10);
     
    12781278        }
    12791279        free(sline);
    1280        
     1280
    12811281        caret_move_absolute(line, pane.ideal_column, dir_before, false);
    12821282}
     
    13371337{
    13381338        char *pattern;
    1339        
     1339
    13401340        const char *prompt_text = "Find next";
    13411341        if (reverse)
    13421342                prompt_text = "Find previous";
    1343        
     1343
    13441344        const char *default_value = "";
    13451345        if (pane.previous_search)
    13461346                default_value = pane.previous_search;
    1347        
     1347
    13481348        pattern = prompt(prompt_text, default_value);
    13491349        if (pattern == NULL) {
     
    13511351                return;
    13521352        }
    1353        
     1353
    13541354        if (pane.previous_search)
    13551355                free(pane.previous_search);
    13561356        pane.previous_search = pattern;
    13571357        pane.previous_search_reverse = reverse;
    1358        
     1358
    13591359        search(pattern, reverse);
    13601360}
     
    13661366                return;
    13671367        }
    1368        
     1368
    13691369        search(pane.previous_search, pane.previous_search_reverse);
    13701370}
     
    13731373{
    13741374        status_display("Searching...");
    1375        
     1375
    13761376        spt_t sp, producer_pos;
    13771377        tag_get_pt(&pane.caret_pos, &sp);
    1378        
     1378
    13791379        /* Start searching on the position before/after caret */
    13801380        if (!reverse) {
     
    13851385        }
    13861386        producer_pos = sp;
    1387        
     1387
    13881388        search_ops_t ops = search_spt_ops;
    13891389        if (reverse)
    13901390                ops = search_spt_reverse_ops;
    1391        
     1391
    13921392        search_t *search = search_init(pattern, &producer_pos, ops, reverse);
    13931393        if (search == NULL) {
     
    13951395                return;
    13961396        }
    1397        
     1397
    13981398        match_t match;
    13991399        errno_t rc = search_next_match(search, &match);
     
    14021402                search_fini(search);
    14031403        }
    1404        
     1404
    14051405        if (match.end) {
    14061406                status_display("Match found.");
     
    14231423                status_display("Not found.");
    14241424        }
    1425        
     1425
    14261426        search_fini(search);
    14271427}
     
    17161716        console_set_pos(con, 0, scr_rows - 1);
    17171717        console_set_style(con, STYLE_INVERTED);
    1718        
     1718
    17191719        int pos = -(scr_columns - 3);
    17201720        printf(" %*s ", pos, str);
Note: See TracChangeset for help on using the changeset viewer.