diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-11 20:28:12 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-11 20:28:12 +0100 |
commit | 59eb0628db77e1145db797406e4de9f97b70d8e2 (patch) | |
tree | 5d797e99a5081e750cf906fe620247d5fa3e7fb7 /qbuffers.cpp | |
parent | 8c6c6afe144adca0635edd0438b9889b3c3df6e4 (diff) | |
download | sciteco-59eb0628db77e1145db797406e4de9f97b70d8e2.tar.gz |
<x,y>Xq command, automatic profile munging, explicit munging, commandline option processing, unhandled commandline options in default buffer
Diffstat (limited to 'qbuffers.cpp')
-rw-r--r-- | qbuffers.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/qbuffers.cpp b/qbuffers.cpp index acbcb9a..c649fce 100644 --- a/qbuffers.cpp +++ b/qbuffers.cpp @@ -25,6 +25,7 @@ namespace States { StateSetQRegInteger setqreginteger; StateIncreaseQReg increaseqreg; StateMacro macro; + StateCopyToQReg copytoqreg; } Ring ring; @@ -426,3 +427,41 @@ StateMacro::got_register(QRegister *reg) return &States::start; } + +State * +StateCopyToQReg::got_register(QRegister *reg) +{ + gint64 from, len; + Sci_TextRange tr; + + BEGIN_EXEC(&States::start); + expressions.eval(); + + if (expressions.args() <= 1) { + from = editor_msg(SCI_GETCURRENTPOS); + sptr_t line = editor_msg(SCI_LINEFROMPOSITION, from) + + expressions.pop_num_calc(); + len = editor_msg(SCI_POSITIONFROMLINE, line) - from; + + if (len < 0) { + from += len; + len *= -1; + } + } else { + gint64 to = expressions.pop_num(); + from = expressions.pop_num(); + len = to - from; + } + + tr.chrg.cpMin = from; + tr.chrg.cpMax = from + len; + tr.lpstrText = (char *)g_malloc(len + 1); + editor_msg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr); + + undo.push_var<gint>(reg->dot); + undo.push_msg(SCI_UNDO); + reg->set_string(tr.lpstrText); + g_free(tr.lpstrText); + + return &States::start; +} |