Subversion Repositories SvarDOS

Rev

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

Rev 1343 Rev 1345
Line 162... Line 162...
162
 
162
 
163
  for (;;) {
163
  for (;;) {
164
    mdr_cout_locate(y, x + len);
164
    mdr_cout_locate(y, x + len);
165
    k = keyb_getkey();
165
    k = keyb_getkey();
166
 
166
 
-
 
167
    switch (k) {
167
    if (k == 0x1b) return; /* ESC */
168
      case 0x1b: /* ESC */
-
 
169
        s[0] = 0;
168
 
170
        return;
169
    if (k == '\r') {
171
      case '\r':
170
      s[len] = 0;
172
        s[len] = 0;
171
      return;
173
        return;
172
    }
174
      case 0x08: /* BKSPC */
173
 
-
 
174
    if ((k == 0x08) && (len > 0)) { /* BKSPC */
175
        if (len > 0) {
175
      len--;
176
          len--;
176
      mdr_cout_char(y, x + len, ' ', SCHEME_STBAR3);
177
          mdr_cout_char(y, x + len, ' ', SCHEME_STBAR3);
-
 
178
        }
177
      continue;
179
        break;
178
    }
180
      default:
179
 
-
 
180
    if ((k <= 0xff) && (k >= ' ') && (len < maxlen)) {
181
        if ((k <= 0xff) && (k >= ' ') && (len < maxlen)) {
181
      mdr_cout_char(y, x + len, k, SCHEME_STBAR3);
182
          mdr_cout_char(y, x + len, k, SCHEME_STBAR3);
182
      s[len++] = k;
183
          s[len++] = k;
-
 
184
        }
183
    }
185
    }
184
 
-
 
185
  }
186
  }
-
 
187
 
186
}
188
}
187
 
189
 
188
 
190
 
189
/* append a nul-terminated string to line at cursor position */
191
/* append a nul-terminated string to line at cursor position */
190
static int line_append(struct file *f, const char far *buf, unsigned short len) {
192
static int line_append(struct file *f, const char far *buf, unsigned short len) {
Line 242... Line 244...
242
 
244
 
243
  y = (screenh - 6) >> 1;
245
  y = (screenh - 6) >> 1;
244
  x = (screenw - msglen - 4) >> 1;
246
  x = (screenw - msglen - 4) >> 1;
245
  for (i = y+2+msg2flag; i >= y; i--) mdr_cout_char_rep(i, x, ' ', attr, msglen + 2);
247
  for (i = y+2+msg2flag; i >= y; i--) mdr_cout_char_rep(i, x, ' ', attr, msglen + 2);
246
  x++;
248
  x++;
-
 
249
 
247
  mdr_cout_str(y+1, x, msg1, attr, msglen);
250
  mdr_cout_str(y+1, x, msg1, attr, msglen);
248
  if (msg2) mdr_cout_str(y+2, x, msg2, attr, msglen);
251
  if (msg2) mdr_cout_str(y+2, x, msg2, attr, msglen);
249
 
252
 
250
  if (uidirty.from > y) uidirty.from = y;
253
  if (uidirty.from > y) uidirty.from = y;
251
  if (uidirty.to < y+4) uidirty.to = y+4;
254
  if (uidirty.to < y+4) uidirty.to = y+4;
Line 883... Line 886...
883
      if (ui_confirm_if_unsaved(db) == 0) clear_file(db);
886
      if (ui_confirm_if_unsaved(db) == 0) clear_file(db);
884
      uidirty.from = 0;
887
      uidirty.from = 0;
885
      uidirty.to = 0xff;
888
      uidirty.to = 0xff;
886
      uidirty.statusbar = 1;
889
      uidirty.statusbar = 1;
887
 
890
 
-
 
891
    } else if (k == 0x13d) { /* F3 (load file) */
-
 
892
      char fname[25];
-
 
893
 
-
 
894
      /* display a warning if unsaved changes are pending */
-
 
895
      if (db->modflag != 0) ui_msg(svarlang_str(0,4), svarlang_str(0,8), SCHEME_MSG);
-
 
896
 
-
 
897
      /* ask for filename */
-
 
898
      ui_getstring(svarlang_str(0,7), fname, sizeof(fname));
-
 
899
      if (fname[0] != 0) {
-
 
900
        clear_file(db);
-
 
901
        db = loadfile(fname);
-
 
902
      }
-
 
903
      uidirty.from = 0;
-
 
904
      uidirty.to = 0xff;
-
 
905
      uidirty.statusbar = 1;
-
 
906
 
888
    } else if ((k == 0x13f) || (k == 0x140)) { /* F5 or F6 */
907
    } else if ((k == 0x13f) || (k == 0x140)) { /* F5 or F6 */
889
      int saveres;
908
      int saveres;
890
 
909
 
891
      if ((k == 0x140) || (db->fname[0] == 0)) { /* save as... */
910
      if ((k == 0x140) || (db->fname[0] == 0)) { /* save as... */
892
        char fname[25];
911
        char fname[25];