From 7877a91fa1951630c4ac6351d0ec0b35327038c4 Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Tue, 25 Aug 2009 18:26:00 +0200 Subject: [PATCH] Changed mp.move_left() to return the document. --- mp_edit.mpsl | 11 +++++++++-- mp_move.mpsl | 8 +++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mp_edit.mpsl b/mp_edit.mpsl index 5a57c63..00ec207 100644 --- a/mp_edit.mpsl +++ b/mp_edit.mpsl @@ -39,8 +39,15 @@ mp.actions['delete_line'] = sub (d) { mp.store_undo(d); mp.delete_line(d); }; mp.actions['insert_space'] = sub (d) { mp.store_undo(d); mp.insert_space(d); }; mp.actions['insert_tab'] = sub (d) { mp.store_undo(d); mp.insert_tab(d); }; mp.actions['delete'] = sub (d) { mp.store_undo(d); mp.delete_char(d); }; -mp.actions['delete_left'] = sub (d) { mp.store_undo(d); mp.move_left(d) && - mp.delete_char(d); }; + +mp.actions['delete_left'] = sub (d) { + if (d.txt.x + d.txt.y) { + mp.store_undo(d); + mp.move_left(d); + mp.delete_char(d); + } +}; + mp.actions['undo'] = sub (d) { mp.undo(d); }; mp.actions['redo'] = sub (d) { mp.redo(d); }; mp.actions['join_paragraph'] = sub (d) { mp.store_undo(d); mp.join_paragraph(d); }; diff --git a/mp_move.mpsl b/mp_move.mpsl index 982d6df..3d57603 100644 --- a/mp_move.mpsl +++ b/mp_move.mpsl @@ -372,12 +372,10 @@ sub mp.move_pgdn(doc) sub mp.move_left(doc) /* moves one char left */ { - /* return 0 if on BOF */ - if (doc.txt.x + doc.txt.y == 0) - return 0; + if (doc.txt.x + doc.txt.y) + mp.set_x(doc, doc.txt.x - 1); - mp.set_x(doc, doc.txt.x - 1); - return 1; + return doc; } -- 2.11.4.GIT