Changeset 3895e23
- Timestamp:
- Dec 25, 2003, 12:05:02 AM (19 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 280ddc6
- Parents:
- 330bcec
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r330bcec r3895e23 7 7 In the sepbar, reverse video the view name when it's not set to 8 8 view_home (as opposed to the static 'all'). 9 The '!' key (bound to 'view -r') now creates a negative version of 10 the current view and switches to it. i.e. "show me all the 11 messages that are not these" 9 12 10 13 2.1.1-pre-2 -
commands.c
r40458b9 r3895e23 548 548 OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE, 549 549 "view messages matching a filter", 550 "view [<viewname>] [-f <filter> | --home ] [-s <style>]\n"550 "view [<viewname>] [-f <filter> | --home | -r ] [-s <style>]\n" 551 551 "view <filter>\n" 552 552 "view -d <expression>\n" … … 1226 1226 } 1227 1227 if (filtname) { 1228 owl_function_change_ view(filtname);1228 owl_function_change_currentview_filter(filtname); 1229 1229 owl_free(filtname); 1230 1230 } … … 1910 1910 } 1911 1911 1912 1913 /* Backwards compatability has made this kind of complicated: 1914 * view [<viewname>] [-f <filter> | -d <expression> | --home | -r ] [-s <style>] 1915 * view <filter> 1916 * view -d <expression> 1917 * view --home 1918 */ 1912 1919 char *owl_command_view(int argc, char **argv, char *buff) 1913 1920 { 1914 1915 /* Backwards compatability has made this kind of complicated: 1916 * view [<viewname>] [-f <filter> | -d <expression> | --home ] [-s <style>] 1917 * view <filter> 1918 * view -d <expression> 1919 * view --home 1920 */ 1921 1922 /* First take the 'view --home' case */ 1923 if (argc == 2 && !strcmp(argv[1], "--home")) { 1924 owl_function_change_view(owl_global_get_view_home(&g)); 1925 return(NULL); 1921 /* First take the 'view --home' and 'view -r' cases */ 1922 if (argc == 2) { 1923 if (!strcmp(argv[1], "--home")) { 1924 owl_function_change_currentview_filter(owl_global_get_view_home(&g)); 1925 return(NULL); 1926 } else if (!strcmp(argv[1], "-r")) { 1927 char *foo; 1928 foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); 1929 owl_function_change_currentview_filter(foo); 1930 return(NULL); 1931 } 1926 1932 } 1927 1933 1928 1934 /* Now look for 'view <filter>' */ 1929 1935 if (argc==2) { 1930 owl_function_change_ view(argv[1]);1936 owl_function_change_currentview_filter(argv[1]); 1931 1937 return(NULL); 1932 1938 } … … 1944 1950 } 1945 1951 owl_function_create_filter(argc, myargv); 1946 owl_function_change_ view("owl-dynamic");1952 owl_function_change_currentview_filter("owl-dynamic"); 1947 1953 owl_free(myargv); 1948 1954 return NULL; … … 1956 1962 argc--; 1957 1963 argv++; 1958 if (strcmp(argv[0], "-f") && strcmp(argv[0], "-d") && strcmp(argv[0], "--home") && strcmp(argv[0], "-s")) { 1964 if (strcmp(argv[0], "-f") && 1965 strcmp(argv[0], "-d") && 1966 strcmp(argv[0], "--home") && 1967 strcmp(argv[0], "-s") && 1968 strcmp(argv[0], "-r")) { 1959 1969 if (strcmp(argv[0], "main")) { 1960 1970 owl_function_makemsg("No view named '%s'", argv[0]); … … 1970 1980 return(NULL); 1971 1981 } 1972 owl_function_change_ view(argv[1]);1982 owl_function_change_currentview_filter(argv[1]); 1973 1983 argc-=2; 1974 1984 argv+=2; 1975 1985 } else if (!strcmp(argv[0], "--home")) { 1976 owl_function_change_ view(owl_global_get_view_home(&g));1986 owl_function_change_currentview_filter(owl_global_get_view_home(&g)); 1977 1987 argc--; 1978 1988 argv++; 1989 } else if (!strcmp(argv[0], "-r")) { 1990 char *foo; 1991 foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g))); 1992 owl_function_change_currentview_filter(foo); 1979 1993 } else if (!strcmp(argv[0], "-s")) { 1980 1994 if (argc<2) { … … 2069 2083 } 2070 2084 filtname = owl_function_classinstfilt(argv[1], NULL); 2071 owl_function_change_ view(filtname);2085 owl_function_change_currentview_filter(filtname); 2072 2086 owl_free(filtname); 2073 2087 return NULL; … … 2082 2096 } 2083 2097 filtname=owl_function_zuserfilt(argv[1]); 2084 owl_function_change_ view(filtname);2098 owl_function_change_currentview_filter(filtname); 2085 2099 owl_free(filtname); 2086 2100 return NULL; -
functions.c
r40458b9 r3895e23 2250 2250 } 2251 2251 2252 #if 0 2253 void owl_function_change_view_old(char *filtname) 2252 void owl_function_change_currentview_filter(char *filtname) 2254 2253 { 2255 2254 owl_view *v; … … 2259 2258 2260 2259 v=owl_global_get_current_view(&g); 2260 2261 2261 curmsg=owl_global_get_curmsg(&g); 2262 2262 if (curmsg==-1) { … … 2270 2270 } 2271 2271 2272 /* grab the filter */;2273 2272 f=owl_global_get_filter(&g, filtname); 2274 2273 if (!f) { … … 2277 2276 } 2278 2277 2279 /* free the existing view and create a new one based on the filter */ 2280 owl_view_free(v); 2281 owl_view_create(v, f); 2278 owl_view_new_filter(v, f); 2282 2279 2283 2280 /* Figure out what to set the current message to. … … 2293 2290 2294 2291 owl_global_set_curmsg(&g, newpos); 2295 2296 2292 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 2297 2293 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2298 2294 owl_global_set_direction_downwards(&g); 2299 2295 } 2300 #endif2301 2302 void owl_function_change_view(char *filtname)2303 {2304 owl_view *v;2305 owl_filter *f;2306 int curid=-1, newpos, curmsg;2307 owl_message *curm=NULL;2308 2309 v=owl_global_get_current_view(&g);2310 2311 curmsg=owl_global_get_curmsg(&g);2312 if (curmsg==-1) {2313 owl_function_debugmsg("Hit the curmsg==-1 case in change_view");2314 } else {2315 curm=owl_view_get_element(v, curmsg);2316 if (curm) {2317 curid=owl_message_get_id(curm);2318 owl_view_save_curmsgid(v, curid);2319 }2320 }2321 2322 f=owl_global_get_filter(&g, filtname);2323 if (!f) {2324 owl_function_error("Unknown filter %s", filtname);2325 return;2326 }2327 2328 owl_view_new_filter(v, f);2329 2330 /* Figure out what to set the current message to.2331 * - If the view we're leaving has messages in it, go to the closest message2332 * to the last message pointed to in that view.2333 * - If the view we're leaving is empty, try to restore the position2334 * from the last time we were in the new view. */2335 if (curm) {2336 newpos = owl_view_get_nearest_to_msgid(v, curid);2337 } else {2338 newpos = owl_view_get_nearest_to_saved(v);2339 }2340 2341 owl_global_set_curmsg(&g, newpos);2342 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);2343 owl_mainwin_redisplay(owl_global_get_mainwin(&g));2344 owl_global_set_direction_downwards(&g);2345 }2346 2296 2347 2297 void owl_function_create_filter(int argc, char **argv) … … 2355 2305 return; 2356 2306 } 2307 2308 owl_function_debugmsg("owl_function_create_filter: starting to create filter named %s", argv[1]); 2357 2309 2358 2310 v=owl_global_get_current_view(&g); … … 2405 2357 /* if it was in use by the current view then update */ 2406 2358 if (inuse) { 2407 owl_function_change_ view(argv[1]);2359 owl_function_change_currentview_filter(argv[1]); 2408 2360 } 2409 2361 owl_global_set_needrefresh(&g); 2410 2362 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2363 } 2364 2365 /* If 'filtername' does not start with 'not-' create a filter named 2366 * 'not-<filtername>' defined as "not filter <filtername>". If the 2367 * filter 'not-<filtername>' already exists, do not overwrite it. If 2368 * 'filtername' begins with 'not-' and a filter 'filtername' already 2369 * exists, then do nothing. If the filter 'filtername' does not 2370 * exist, create it and define it as 'not filter <filtername>' 2371 * 2372 * Returns the name of the negated filter, which the caller must free. 2373 */ 2374 char *owl_function_create_negative_filter(char *filtername) 2375 { 2376 char *newname; 2377 owl_filter *tmpfilt; 2378 char *argv[5]; 2379 2380 owl_function_debugmsg("owl_function_create_negative_filter"); 2381 2382 if (!strncmp(filtername, "not-", 4)) { 2383 newname=owl_strdup(filtername+4); 2384 } else { 2385 newname=owl_sprintf("not-%s", filtername); 2386 } 2387 2388 tmpfilt=owl_global_get_filter(&g, newname); 2389 if (!tmpfilt) { 2390 argv[0]="filter"; /* anything is fine here */ 2391 argv[1]=newname; 2392 argv[2]="not"; 2393 argv[3]="filter"; 2394 argv[4]=filtername; 2395 owl_function_create_filter(5, argv); 2396 } 2397 2398 owl_function_debugmsg("owl_function_create_negative_filter: returning with %s", newname); 2399 return(newname); 2411 2400 } 2412 2401 -
help.c
r15283bb r3895e23 59 59 " V Change to back to home view ('all' by default)\n" 60 60 " v Start a view command\n" 61 " ! Invert the current view\n" 61 62 "\n" 62 63 " l Print a zephyr/AIM buddy listing\n" -
keys.c
r8b16467 r3895e23 218 218 BIND_CMD("v", "start-command view ", "start a view command"); 219 219 BIND_CMD("V", "view --home", "change to the home view ('all' by default)"); 220 BIND_CMD("!", "view -r", "invert the current view filter"); 220 221 BIND_CMD("M-n", "smartnarrow", "narrow to a view based on the current message"); 221 222 BIND_CMD("M-N", "smartnarrow -i", "narrow to a view based on the current message, and consider instance pair");
Note: See TracChangeset
for help on using the changeset viewer.