Changeset 99e5526 in mainline


Ignore:
Timestamp:
2009-09-16T20:19:22Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c29f20b
Parents:
b077886e
Message:

Handle long lines properly.

File:
1 edited

Legend:

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

    rb077886e r99e5526  
    130130
    131131        pane.rows = scr_rows - 1;
     132        pane.columns = scr_columns;
    132133        pane.sh_row = 1;
     134        pane.sh_column = 1;
    133135
    134136        /* Start with an empty sheet. */
     
    402404static void pane_row_range_display(int r0, int r1)
    403405{
    404         int width;
    405406        int i, j, fill;
    406407        spt_t rb, re, dep;
     
    415416        console_goto(con, 0, 0);
    416417        for (i = r0; i < r1; ++i) {
    417                 sheet_get_row_width(&doc.sh, pane.sh_row + i, &width);
    418 
    419                 /* Determine row starting point. */
    420                 rbc.row = pane.sh_row + i; rbc.column = 1;
     418                /* Starting point for row display */
     419                rbc.row = pane.sh_row + i;
     420                rbc.column = pane.sh_column;
    421421                sheet_get_cell_pt(&doc.sh, &rbc, dir_before, &rb);
    422422
    423                 /* Determine row ending point. */
    424                 rec.row = pane.sh_row + i; rec.column = width + 1;
     423                /* Ending point for row display */
     424                rec.row = pane.sh_row + i;
     425                rec.column = pane.sh_column + pane.columns;
    425426                sheet_get_cell_pt(&doc.sh, &rec, dir_before, &re);
    426427
     
    494495
    495496        spt_get_coord(&caret_pt, &coord);
    496         console_goto(con, coord.column - 1, coord.row - pane.sh_row);
     497        console_goto(con, coord.column - pane.sh_column,
     498            coord.row - pane.sh_row);
    497499}
    498500
     
    555557        spt_get_coord(&pt, &coord);
    556558
    557         /* Scroll pane as necessary. */
     559        /* Scroll pane vertically. */
    558560
    559561        if (coord.row < pane.sh_row) {
     
    561563                pane.rflags |= REDRAW_TEXT;
    562564        }
     565
    563566        if (coord.row > pane.sh_row + pane.rows - 1) {
    564567                pane.sh_row = coord.row - pane.rows + 1;
     
    566569        }
    567570
     571        /* Scroll pane horizontally. */
     572
     573        if (coord.column < pane.sh_column) {
     574                pane.sh_column = coord.column;
     575                pane.rflags |= REDRAW_TEXT;
     576        }
     577
     578        if (coord.column > pane.sh_column + pane.columns - 1) {
     579                pane.sh_column = coord.column - pane.columns + 1;
     580                pane.rflags |= REDRAW_TEXT;
     581        }
     582
    568583        pane.rflags |= (REDRAW_CARET | REDRAW_STATUS);
    569 
    570584}
    571585
Note: See TracChangeset for help on using the changeset viewer.