Commit fca4fdc6028dca5c78526f300476bda3fe870970

Authored by Perry Werneck
2 parents 70cf0f40 6dbff7aa

Merge branch 'master' into develop

src/core/actions/table.c
... ... @@ -37,6 +37,7 @@
37 37 #include <lib3270/actions.h>
38 38 #include <lib3270/toggle.h>
39 39 #include <lib3270/log.h>
  40 +#include <lib3270/selection.h>
40 41  
41 42 /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/
42 43  
... ... @@ -250,6 +251,20 @@
250 251 .activatable = lib3270_is_connected
251 252 },
252 253  
  254 + {
  255 + .name = "select-word",
  256 + .type = LIB3270_ACTION_TYPE_SELECTION,
  257 +
  258 + .keys = "<Ctrl>w",
  259 + .icon = NULL,
  260 + .label = N_( "Select word" ),
  261 + .summary = N_( "Select word" ),
  262 + .activate = lib3270_select_word,
  263 +
  264 + .group = LIB3270_ACTION_GROUP_ONLINE,
  265 + .activatable = lib3270_is_connected
  266 + },
  267 +
253 268 //
254 269 // Field actions.
255 270 //
... ...
src/core/bounds.c
... ... @@ -76,8 +76,15 @@ LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *session, int baddr, int *start
76 76  
77 77 CHECK_SESSION_HANDLE(session);
78 78  
79   - if(!lib3270_is_connected(session) || isspace(session->text[baddr].chr))
80   - return -1;
  79 + if(baddr < 0)
  80 + baddr = lib3270_get_cursor_address(session);
  81 +
  82 + if(baddr > lib3270_get_length(session)) {
  83 + return errno = EINVAL;
  84 + }
  85 +
  86 + if(!lib3270_is_connected(session))
  87 + return errno = ENOTCONN;
81 88  
82 89 if(start)
83 90 {
... ...
src/include/lib3270/selection.h
... ... @@ -79,6 +79,7 @@
79 79 LIB3270_EXPORT int lib3270_unselect(H3270 *session);
80 80 LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr);
81 81 LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr);
  82 + LIB3270_EXPORT int lib3270_select_word(H3270 *session);
82 83 LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr);
83 84 LIB3270_EXPORT int lib3270_select_field(H3270 *session);
84 85 LIB3270_EXPORT int lib3270_select_all(H3270 *session);
... ...
src/selection/actions.c
... ... @@ -109,6 +109,11 @@ LIB3270_EXPORT int lib3270_select_region(H3270 *h, int start, int end)
109 109 return 0;
110 110 }
111 111  
  112 +LIB3270_EXPORT int lib3270_select_word(H3270 *session)
  113 +{
  114 + return lib3270_select_word_at(session,-1);
  115 +}
  116 +
112 117 LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr)
113 118 {
114 119 int start, end;
... ...