Changeset 1fd0b25 for functions.c
- Timestamp:
- Aug 17, 2002, 10:31:35 AM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 37c27cf
- Parents:
- 8509c08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
rf2e36b5 r1fd0b25 1597 1597 1598 1598 if (argc<2) { 1599 owl_function_makemsg("Wrong number of arguments to the pexec command");1599 owl_function_makemsg("Wrong number of arguments to the exec command"); 1600 1600 return NULL; 1601 1601 } … … 2182 2182 /* TODO: implement for real */ 2183 2183 void owl_function_show_keymap(char *name) { 2184 owl_fmtext 2184 owl_fmtext fm; 2185 2185 owl_keymap *km; 2186 2186 … … 2198 2198 2199 2199 void owl_function_help_for_command(char *cmdname) { 2200 owl_fmtext 2200 owl_fmtext fm; 2201 2201 2202 2202 owl_fmtext_init_null(&fm); … … 2205 2205 owl_fmtext_free(&fm); 2206 2206 } 2207 2208 void owl_function_search_start(char *string, int direction) { 2209 /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */ 2210 owl_global_set_search_active(&g, string); 2211 owl_function_search_helper(0, direction); 2212 } 2213 2214 void owl_function_search_continue(int direction) { 2215 /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */ 2216 owl_function_search_helper(1, direction); 2217 } 2218 2219 void owl_function_search_helper(int mode, int direction) { 2220 /* move to a message that contains the string. If direction is 2221 * OWL_DIRECTION_DOWNWARDS then search fowards, if direction is 2222 * OWL_DIRECTION_UPWARDS then search backwards. 2223 * 2224 * If mode==0 then it will stay on the current message if it 2225 * contains the string. 2226 */ 2227 2228 owl_view *v; 2229 int viewsize, i, curmsg, start; 2230 owl_message *m; 2231 2232 v=owl_global_get_current_view(&g); 2233 viewsize=owl_view_get_size(v); 2234 curmsg=owl_global_get_curmsg(&g); 2235 2236 if (viewsize==0) { 2237 owl_function_makemsg("No messages present"); 2238 return; 2239 } 2240 2241 if (mode==0) { 2242 start=curmsg; 2243 } else if (direction==OWL_DIRECTION_DOWNWARDS) { 2244 start=curmsg+1; 2245 } else { 2246 start=curmsg-1; 2247 } 2248 2249 /* bounds check */ 2250 if (start>=viewsize || start<0) { 2251 owl_function_makemsg("No further matches found"); 2252 return; 2253 } 2254 2255 for (i=start; i<viewsize && i>=0;) { 2256 m=owl_view_get_element(v, i); 2257 if (owl_message_search(m, owl_global_get_search_string(&g))) { 2258 owl_global_set_curmsg(&g, i); 2259 owl_function_calculate_topmsg(direction); 2260 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2261 if (direction==OWL_DIRECTION_DOWNWARDS) { 2262 owl_global_set_direction_downwards(&g); 2263 } else { 2264 owl_global_set_direction_upwards(&g); 2265 } 2266 return; 2267 } 2268 if (direction==OWL_DIRECTION_DOWNWARDS) { 2269 i++; 2270 } else { 2271 i--; 2272 } 2273 } 2274 owl_function_makemsg("No matches found"); 2275 } 2276 2277 2278 /* strips formatting from ztext and returns the unformatted text. 2279 * caller is responsible for freeing. */ 2280 char *owl_function_ztext_stylestrip(char *zt) { 2281 owl_fmtext fm; 2282 char *plaintext; 2283 2284 owl_fmtext_init_null(&fm); 2285 owl_fmtext_append_ztext(&fm, zt); 2286 plaintext = owl_fmtext_print_plain(&fm); 2287 owl_fmtext_free(&fm); 2288 return(plaintext); 2289 }
Note: See TracChangeset
for help on using the changeset viewer.