diff options
author | 2013-11-10 23:15:51 -0500 | |
---|---|---|
committer | 2013-11-10 23:15:51 -0500 | |
commit | 76ac1add61cb26f39ad8cd299f68f1bb2d2798c9 (patch) | |
tree | 5c5969c8d65e7964efc0b4f6c51d3ad60e7f6a8f | |
parent | 922c95cf6711f80cbb6d3a16de98ac14a0ed6f66 (diff) |
`ui.clipboard_text` is no longer read-only.
-rw-r--r-- | core/ui.lua | 2 | ||||
-rw-r--r-- | src/textadept.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/ui.lua b/core/ui.lua index 201ed1ea..8c9db70e 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -11,7 +11,7 @@ local ui = ui -- The buffer's context menu, a [`ui.menu()`](#menu). -- This is a low-level field. You probably want to use the higher-level -- `textadept.menu.set_contextmenu()`. --- @field clipboard_text (string, Read-only) +-- @field clipboard_text (string) -- The text on the clipboard. -- @field statusbar_text (string, Write-only) -- The text displayed in the statusbar. diff --git a/src/textadept.c b/src/textadept.c index ba48149c..b1400cd9 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -369,8 +369,8 @@ static char *get_clipboard() { #define max(a, b) (((a) > (b)) ? (a) : (b)) #define bind(k, d) bindCDKObject(vENTRY, find_entry, k, entry_keypress, d), \ bindCDKObject(vENTRY, replace_entry, k, entry_keypress, d) -#define set_clipboard(t) SS(focused_view, SCI_COPYTEXT, strlen(t), (sptr_t)t) #endif +#define set_clipboard(t) SS(focused_view, SCI_COPYTEXT, strlen(t), (sptr_t)t) /** `find.focus()` Lua function. */ static int lfind_focus(lua_State *L) { @@ -988,7 +988,7 @@ static int lui__newindex(lua_State *L) { mvaddstr(0, 0, lua_tostring(L, 3)), refresh(); #endif } else if (strcmp(key, "clipboard_text") == 0) - luaL_argerror(L, 3, "read-only property"); + set_clipboard(luaL_checkstring(L, 3)); else if (strcmp(key, "statusbar_text") == 0) set_statusbar_text(lua_tostring(L, 3), 0); else if (strcmp(key, "bufstatusbar_text") == 0) |