Subversion Repositories SvarDOS

Rev

Rev 1350 | Rev 1352 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1350 Rev 1351
Line 331... Line 331...
331
      mdr_cout_char_rep(y++, 0, ' ', SCHEME_TEXT, screenw - 1);
331
      mdr_cout_char_rep(y++, 0, ' ', SCHEME_TEXT, screenw - 1);
332
    }
332
    }
333
  }
333
  }
334
 
334
 
335
  /* "file changed" flag */
335
  /* "file changed" flag */
336
  {
-
 
337
    char flg = ' ';
-
 
338
    if (db->modflag) flg = '*';
-
 
339
    mdr_cout_char(screenh - 1, 0, flg, SCHEME_STBAR1);
336
  mdr_cout_char(screenh - 1, 0, db->modflag, SCHEME_STBAR1);
340
  }
-
 
341
 
337
 
342
  /* scroll bar */
338
  /* scroll bar */
343
  for (y = 0; y < (screenh - 1); y++) {
339
  for (y = 0; y < (screenh - 1); y++) {
344
    mdr_cout_char(y, screenw - 1, SCROLL_CURSOR, SCHEME_SCROLL);
340
    mdr_cout_char(y, screenw - 1, SCROLL_CURSOR, SCHEME_SCROLL);
345
  }
341
  }
Line 463... Line 459...
463
  if (db->cursorposx + db->xoffset < db->cursor->len) {
459
  if (db->cursorposx + db->xoffset < db->cursor->len) {
464
    _fmemmove(db->cursor->payload + db->cursorposx + db->xoffset, db->cursor->payload + db->cursorposx + db->xoffset + 1, db->cursor->len - db->cursorposx - db->xoffset);
460
    _fmemmove(db->cursor->payload + db->cursorposx + db->xoffset, db->cursor->payload + db->cursorposx + db->xoffset + 1, db->cursor->len - db->cursorposx - db->xoffset);
465
    db->cursor->len -= 1; /* do this AFTER memmove so the copy includes the nul terminator */
461
    db->cursor->len -= 1; /* do this AFTER memmove so the copy includes the nul terminator */
466
    uidirty.from = db->cursorposy;
462
    uidirty.from = db->cursorposy;
467
    uidirty.to = db->cursorposy;
463
    uidirty.to = db->cursorposy;
468
    db->modflag = 1;
464
    db->modflag = '*';
469
  } else if (db->cursor->next != NULL) { /* cursor is at end of line: merge current line with next one (if there is a next one) */
465
  } else if (db->cursor->next != NULL) { /* cursor is at end of line: merge current line with next one (if there is a next one) */
470
    struct line far *nextline = db->cursor->next;
466
    struct line far *nextline = db->cursor->next;
471
    if (db->cursor->next->len > 0) {
467
    if (db->cursor->next->len > 0) {
472
      if (curline_resize(db, db->cursor->len + db->cursor->next->len + 1) == 0) {
468
      if (curline_resize(db, db->cursor->len + db->cursor->next->len + 1) == 0) {
473
        _fmemmove(db->cursor->payload + db->cursor->len, db->cursor->next->payload, db->cursor->next->len + 1);
469
        _fmemmove(db->cursor->payload + db->cursor->len, db->cursor->next->payload, db->cursor->next->len + 1);
Line 480... Line 476...
480
 
476
 
481
    line_free(nextline);
477
    line_free(nextline);
482
    uidirty.from = db->cursorposy;
478
    uidirty.from = db->cursorposy;
483
    uidirty.to = 0xff;
479
    uidirty.to = 0xff;
484
    db->totlines -= 1;
480
    db->totlines -= 1;
485
    db->modflag = 1;
481
    db->modflag = '*';
486
  }
482
  }
487
}
483
}
488
 
484
 
489
 
485
 
490
static void bkspc(struct file *db) {
486
static void bkspc(struct file *db) {
Line 668... Line 664...
668
 
664
 
669
 
665
 
670
static void insert_in_line(struct file *db, const char *databuf, unsigned short len) {
666
static void insert_in_line(struct file *db, const char *databuf, unsigned short len) {
671
  if (curline_resize(db, db->cursor->len + len) == 0) {
667
  if (curline_resize(db, db->cursor->len + len) == 0) {
672
    unsigned short off = db->xoffset + db->cursorposx;
668
    unsigned short off = db->xoffset + db->cursorposx;
673
    db->modflag = 1;
669
    db->modflag = '*';
674
    _fmemmove(db->cursor->payload + off + len, db->cursor->payload + off, db->cursor->len - off + 1);
670
    _fmemmove(db->cursor->payload + off + len, db->cursor->payload + off, db->cursor->len - off + 1);
675
    db->cursor->len += len;
671
    db->cursor->len += len;
676
    uidirty.from = db->cursorposy;
672
    uidirty.from = db->cursorposy;
677
    uidirty.to = db->cursorposy;
673
    uidirty.to = db->cursorposy;
678
    while (len--) {
674
    while (len--) {
Line 845... Line 841...
845
 
841
 
846
    } else if (k == 0x0D) { /* ENTER */
842
    } else if (k == 0x0D) { /* ENTER */
847
      unsigned short off = db->xoffset + db->cursorposx;
843
      unsigned short off = db->xoffset + db->cursorposx;
848
      /* add a new line */
844
      /* add a new line */
849
      if (line_add(db, db->cursor->payload + off, db->cursor->len - off) == 0) {
845
      if (line_add(db, db->cursor->payload + off, db->cursor->len - off) == 0) {
850
        db->modflag = 1;
846
        db->modflag = '*';
851
        db->cursor = db->cursor->prev; /* back to original line */
847
        db->cursor = db->cursor->prev; /* back to original line */
852
        /* trim the line above */
848
        /* trim the line above */
853
        db->cursor->len = off;
849
        db->cursor->len = off;
854
        /* move cursor to the (new) line below */
850
        /* move cursor to the (new) line below */
855
        db->curline -= 1;
851
        db->curline -= 1;
Line 939... Line 935...
939
 
935
 
940
      ui_refresh(db);
936
      ui_refresh(db);
941
      uidirty.statusbar = 1;
937
      uidirty.statusbar = 1;
942
 
938
 
943
    } else if (k == 0x144) { /* F10 */
939
    } else if (k == 0x144) { /* F10 */
944
      db->modflag = 1;
940
      db->modflag = '*';
945
      db->lfonly ^= 1;
941
      db->lfonly ^= 1;
946
      uidirty.statusbar = 1;
942
      uidirty.statusbar = 1;
947
 
943
 
948
    } else if (k == 0x174) { /* CTRL+ArrRight - jump to next word */
944
    } else if (k == 0x174) { /* CTRL+ArrRight - jump to next word */
949
      /* if currently cursor is on a non-space, then fast-forward to nearest space or EOL */
945
      /* if currently cursor is on a non-space, then fast-forward to nearest space or EOL */