Skip to content
Snippets Groups Projects
Commit fbc43888 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Don't use handle_backspace() to handle delete.

While they both delete a character, delete at the end of a line will
move the next line up instead of moving this line up.

Fixes #243
parent 35d1f335
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -1483,6 +1483,25 @@ function handle_backspace()
}
}
function handle_delete()
{
last_xpos=-1;
if(xpos>=line[ypos].text.length) {
/* delete the hardcr, */
line[ypos].hardcr=false;
if(!rewrap())
draw_line(ypos,xpos);
return;
}
line[ypos].text=line[ypos].text.substr(0,xpos)
+line[ypos].text.substr(xpos+1);
line[ypos].attr=line[ypos].attr.substr(0,xpos)
+line[ypos].attr.substr(xpos+1);
if(!rewrap())
draw_line(ypos,xpos);
}
function edit(quote_first)
{
var prev_key;
......@@ -1899,19 +1918,7 @@ function edit(quote_first)
console.line_counter=0;
return;
case KEY_DEL: /* DELETE */
last_xpos=-1;
if(xpos>=line[ypos].text.length) {
/* delete the hardcr, */
line[ypos].hardcr=false;
handle_backspace();
break;
}
line[ypos].text=line[ypos].text.substr(0,xpos)
+line[ypos].text.substr(xpos+1);
line[ypos].attr=line[ypos].attr.substr(0,xpos)
+line[ypos].attr.substr(xpos+1);
if(!rewrap())
draw_line(ypos,xpos);
handle_delete();
break;
case 'B':
if(prev_key == '\x18') { /* CTRL-X, ZDLE */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment