sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit 642ea33c2bf764250a083cade278156d183a790a
parent 5093dcb351ee8b19ccd0277659e7d1178c6968ec
Author: Rafael Garcia <rafael.garcia.gallego@gmail.com>
Date:   Mon, 29 Aug 2011 18:38:40 +0200

Autoindenting now controls whether smart-BOL is enabled or not
Diffstat:
config.def.h | 2++
sandy.c | 9++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -80,6 +80,7 @@ static const Key curskeys[] = { /* Plain keys here, no CONTROL or META */ { .keyv.i = KEY_SDC, { t_sel, t_rw, 0, 0 }, f_delete, { .m = m_tosel } }, { .keyv.i = KEY_SDC, { t_rw, 0, 0, 0 }, f_delete, { .m = m_prevchar } }, { .keyv.i = KEY_SIC, { t_rw, 0, 0, 0 }, f_pipenull, FROMCLIP }, +{ .keyv.i = KEY_HOME, { t_ai, 0, 0, 0 }, f_moveboth, { .m = m_smartbol } }, { .keyv.i = KEY_HOME, { 0, 0, 0, 0 }, f_moveboth, { .m = m_bol } }, { .keyv.i = KEY_END, { 0, 0, 0, 0 }, f_moveboth, { .m = m_eol } }, { .keyv.i = KEY_SHOME, { 0, 0, 0, 0 }, f_moveboth, { .m = m_bof } }, @@ -99,6 +100,7 @@ static const Key stdkeys[] = { { .keyv.c = CONTROL('@'), { 0, 0, 0, 0 }, f_move, { .m = m_tomark } }, { .keyv.c = META(' '), { 0, 0, 0, 0 }, f_mark, { 0 } }, { .keyv.c = META('`'), { 0, 0, 0, 0 }, f_mark, { 0 } }, +{ .keyv.c = CONTROL('A'), { t_ai, 0, 0, 0 }, f_move, { .m = m_smartbol } }, { .keyv.c = CONTROL('A'), { 0, 0, 0, 0 }, f_move, { .m = m_bol } }, { .keyv.c = CONTROL('B'), { 0, 0, 0, 0 }, f_move, { .m = m_prevchar } }, { .keyv.c = META('b'), { 0, 0, 0, 0 }, f_move, { .m = m_prevword } }, diff --git a/sandy.c b/sandy.c @@ -253,6 +253,7 @@ static bool t_warn(void); /* m_ functions represent a cursor movement and can be passed in an Arg */ static Filepos m_bof(Filepos); static Filepos m_bol(Filepos); +static Filepos m_smartbol(Filepos); static Filepos m_eof(Filepos); static Filepos m_eol(Filepos); static Filepos m_nextchar(Filepos); @@ -1506,8 +1507,14 @@ m_bof(Filepos pos) { return pos; } -Filepos /* Go to (smart) beginning of line */ +Filepos /* Go to beginning of line */ m_bol(Filepos pos) { + pos.o=0; + return pos; +} + +Filepos /* Go to smart beginning of line */ +m_smartbol(Filepos pos) { Filepos vbol=pos; vbol.o=0;