Commit Graph

40 Commits

Author SHA1 Message Date
Alexander Yakushev f9dd1c3389 awful.prompt: Introduce changed_callback and keypressed_callback to prompt.run
changed_callback allows to execute arbitrary code any time the
command string changes.
keypressed_callback allows to intercept keypresses before
awful.prompt.run code handles them and run arbitrary code depending on
the key pressed and modificators.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-03-05 16:04:46 +01:00
Alexander Yakushev ed444f9b1a awful.prompt: Move update() out of the keygrabber.run callback
It is required to be able to call the update() function from any point
of the keygrabber.run callback.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-03-05 16:03:22 +01:00
Anurag Priyam 3a44fa578e awful.prompt: remove superfluous return true from keygrabber's callback
Returning true from the callback to `keygrabber` is no longer necessary to
continue grabbing the keyboard.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-03-04 11:40:48 +01:00
Uli Schlachter 4f2156299f awful.prompt: Properly stop keygrabber (FS#965)
This was broken since 014d191f66 (which made this kind of stuff mandatory,
because 'return false' is ignored now).  Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-03-04 10:41:25 +01:00
Corey Thompson 47238fe6cf Bump duplicated commands to the most recent in command prompt history
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-05 20:51:48 +01:00
Massimiliano Brocchini 6b8357989e search in prompt history
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-25 13:02:58 +02:00
Massimiliano Brocchini 48e2f41e3b no duplicate entries in prompt history
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-23 17:57:51 +02:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
dodo b530da1861 add set_font to wibox.widget.textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-14 22:37:44 +02:00
Julien Danjou c98624077f awful.prompt: add ctrl-backspace
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-10-21 09:05:40 +02:00
koniu 4429bea62f awful.prompt: add 'autoexec' argument
If set the prompt will execute the command upon completion which returns
only one match.

Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-11 15:22:18 +02:00
Uli Schlachter bb975a2464 awful.prompt: Fix for the new textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 21:27:42 +02:00
immerrr a3f911cf95 awful.prompt: insert selection at cursor position
Signed-off-by: immerrr <immerrr@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-31 13:48:59 +02:00
Uli Schlachter 1cab627d5d awful.prompt: "Fix" for multi-byte characters
If you entered a multi-byte character into a prompt and then changed your mind
and used backspace to fix the character, only the last byte of the character was
removed. Because pango is intelligent, it noticed the broken utf8 and
complained.

So far nothing new. But since 711d78b50c the textbox will throw a lua error
when it gets an invalid text (= pango complains). Throwing an unprotected lua
error in this context causes the keygrabber to be killed which stops the prompt.

Fix this by removing bytes as long as there are bytes left that can be removed.

This is FS#801.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 20:42:22 +02:00
koniu 1b7c822ed3 awful.prompt: word delete splits by separators
Instead of separating only by spaces we also look for:

   { [ ( , . : ; _ - + = @ /

Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-01 14:24:13 +02:00
koniu 2b0de2f23e awful.prompt: reset 'selectall' correctly
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-01 14:24:12 +02:00
koniu 4c835b5ef9 awful.prompt: add 'font' to run() args
Also changes prompt_text_with_cursor() to take a table instead of
list of arguments allowing to incorporate font setting and
'prettyprompt' settings into the function.

Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-01 14:24:11 +02:00
koniu 3849e6d747 awful.prompt: fix delete
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-08 07:58:46 +02:00
Julien Danjou e61ab85f5d keygrabber: use luaA_pushmodifiers()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-27 21:04:15 +02:00
Julien Danjou 40d821354a awful.prompt: close file after reading
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-02 13:39:52 +02:00
Julien Danjou b69e249503 awful.prompt: do not export documentation of local functions
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-01-08 12:23:31 +01:00
Julien Danjou 90b1adc0ce awful.prompt: Tab is now reported as Tab
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-01-05 11:16:08 +01:00
Julien Danjou 5751049745 awful.prompt: add support for Shift+Insert to paste
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-01-04 17:44:37 +01:00
Julien Danjou 8193a9cf0c keygrabber: identify release events
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-16 15:02:54 +01:00
Julien Danjou 13787c0ba8 luaa: do not replace string.len(), export wlen()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-12-15 14:06:22 +01:00
koniu 53d7062917 awful.prompt: improvements to selectall
selectall argument to run():

* renders cursor selection
* is reset when anything but typing occurs
* is now independent from cur_pos == 1

Signed-off-by: koniu <gkusnierz@gmail.com>
2008-12-14 10:28:23 +01:00
Sébastien Gross f5bf5aa43d awful.prompt: Add support for KP_Return
* The numeric paddle Enter key wasn't processed

Signed-off-by: Sébastien Gross <seb-awesome@chezwam.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-29 09:30:28 +01:00
Julien Danjou 41c6fbb31c awful.prompt: return true since we unregistered (FS#383)
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-24 11:56:42 +01:00
koniu 4c031ba398 awful.prompt: add trail space in prompt_text_with_cursor()
Adds a trailing space after text if cursor position < text length to
prevent width of the widget changing particularly useful when using
'text' and 'selectall' to do eg. in-place renaming.

Sample textbox content (# space, _ cursor).

Before:
    textbox before prompt: #term#
selectall prompt textbox : #_erm   <- shorter than other cases
      after pressing end : #term_

After:
    textbox before prompt: #term#
selectall prompt textbox : #_erm#
      after pressing end : #term_

Signed-off-by: koniu <gkusnierz@gmail.com>
2008-11-19 13:00:04 +00:00
koniu b4f16ff649 awful.prompt: new arg 'selectall' in add()
If set along with 'text' (prefilled content) it will position the cursor at
the beginning of the line and and on text input (and not control keys,
arrows, etc.) will overwrite the prefilled content with the new input.

Signed-off-by: koniu <gkusnierz@gmail.com>
2008-11-19 13:21:12 +01:00
koniu a9ed61589f awful.prompt: add new field 'text' to run() args
Signed-off-by: koniu <gkusnierz@gmail.com>
2008-11-17 20:21:12 +01:00
Julien Danjou 80f5d43631 awful.prompt: stop grabbing keyboard before calling callback
This allows execution of grabbing function.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-13 14:07:27 +01:00
Julien Danjou b9398ad51e awful.prompt: merge some keys
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-13 14:06:22 +01:00
Julien Danjou ccfb0b1935 awful.prompt add in history also on 'j' and 'm'
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-13 14:02:38 +01:00
Julien Danjou 9416bf2419 awful.prompt: fix typo
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-13 14:00:21 +01:00
Julien Danjou 2e97991a90 beautiful: merge awful.beautiful, stop registering system
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-11-13 11:54:23 +01:00
koniu d4bfaa8598 awful.prompt: add underline style to in run() args
Signed-off-by: koniu <gkusnierz@gmail.com>
2008-11-06 17:07:12 +00:00
Julien Danjou c1566f39c5 awful.prompt: add math lib
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-30 09:36:40 +02:00
Julien Danjou 6dc84a1c12 awful.prompt: fix history save
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-30 09:22:34 +02:00
Julien Danjou 34647e4e75 awful: split in several modules
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-29 18:30:32 +02:00