Changes in uspace/app/edit/edit.c [cd82bb1:36e9cd1] in mainline


Ignore:
File:
1 edited

Legend:

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

    rcd82bb1 r36e9cd1  
    9898static bool done;
    9999static pane_t pane;
     100static bool cursor_visible;
    100101
    101102static int scr_rows, scr_columns;
     
    108109/** Maximum filename length that can be entered. */
    109110#define INFNAME_MAX_LEN 128
     111
     112static void cursor_show(void);
     113static void cursor_hide(void);
     114static void cursor_setvis(bool visible);
    110115
    111116static void key_handle_unmod(console_event_t const *ev);
     
    199204
    200205        /* Initial display */
     206        cursor_visible = true;
     207
     208        cursor_hide();
    201209        console_clear(con);
    202210        pane_text_display();
     
    205213                status_display("File not found. Starting empty file.");
    206214        pane_caret_display();
    207 
     215        cursor_show();
    208216
    209217        done = false;
     
    230238                /* Redraw as necessary. */
    231239
     240                cursor_hide();
     241
    232242                if (pane.rflags & REDRAW_TEXT)
    233243                        pane_text_display();
     
    238248                if (pane.rflags & REDRAW_CARET)
    239249                        pane_caret_display();
     250
     251                cursor_show();
    240252        }
    241253
     
    243255
    244256        return 0;
     257}
     258
     259static void cursor_show(void)
     260{
     261        cursor_setvis(true);
     262}
     263
     264static void cursor_hide(void)
     265{
     266        cursor_setvis(false);
     267}
     268
     269static void cursor_setvis(bool visible)
     270{
     271        if (cursor_visible != visible) {
     272                console_cursor_visibility(con, visible);
     273                cursor_visible = visible;
     274        }
    245275}
    246276
     
    688718        wchar_t c;
    689719        size_t pos, size;
    690         unsigned s_column;
     720        int s_column;
    691721        coord_t csel_start, csel_end, ctmp;
    692722
     
    736766                s_column = pane.sh_column;
    737767                while (pos < size) {
    738                         if (csel_start.row == rbc.row && csel_start.column == s_column) {
     768                        if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
    739769                                fflush(stdout);
    740770                                console_set_color(con, COLOR_BLACK, COLOR_RED, 0);
     
    742772                        }
    743773       
    744                         if (csel_end.row == rbc.row && csel_end.column == s_column) {
     774                        if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    745775                                fflush(stdout);
    746776                                console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     
    762792                }
    763793
    764                 if (csel_end.row == rbc.row && csel_end.column == s_column) {
     794                if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    765795                        fflush(stdout);
    766796                        console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
Note: See TracChangeset for help on using the changeset viewer.