Add a long_lines test and fix scrolling test
[smenu.git] / FAQ
blob2aeb9a6125e27fff64e7bd5c8f38935bf03700bb
1 Q: What is smenu?
3 A: smenu is a selection tool that acts as a filter that takes 'words'
4    from the standard input or a file and presents them on the screen in
5    various arrangements in a scrolling window.
7    A cursor that you can easily move allows you to select one or more
8    of them.
10    The selected 'words' are printed on the standard output.
11 --------
12 Q: Why smenu tells me: "The length of a 'word' has reached the limit of
13    512 characters." but there is no such 'word' in my entry?
15 A: It is likely that you have an unbalanced single or double quotation
16    mark somewhere. smenu uses quotation marks to be able to have spaces
17    in 'words', and quotation marks that are not used as delimiters must
18    be protected.
20    You can use something like: sed -e "s/'/\\\'/g" -e 's/"/\\"/g' to
21    pre-process the input in such a case.
23    Another solution is to ask smenu to treat quotation marks as normal
24    characters by using the -Q|-ignore_quotes option.
25 --------
26 Q: Why does smenu -C... no longer work?
28 A: smenu uses a new system of options based on the notion of contexts. The
29    -C parameter is only valid in the "Columns" context as indicated in the
30    error message.
32    The string '[-c|-col|-col_mode|-column>Columns]' that is printed
33    in the error message indicates that to switch to "Columns" mode
34    must use the -c parameter or its alternatives.
36    In this case the correct command line should contain something like:
37    smenu -c -C...
38 --------
39 Q: How to preserve the original alignment of the columns?
41 A: smenu merges multiple occurrences of word delimiters (' ' in the
42    example below) and so the original alignment of columns is lost.
43    One way to limit this loss is to replace the delimiter with a character
44    that does not appear in the input and is not a delimiter, we will use
45    '!' in the example, and tell smenu to replace it with a space with the
46    -S option.
48    Example of a session using the free command:
50    $ free
51                   total        used        free      shared  buff/cache   available
52    Mem:            23Gi       4,3Gi       1,6Gi       118Mi        18Gi        19Gi
53    Swap:          2,0Gi       0,0Ki       2,0Gi
55    $ free -h | smenu -c
56    total used  free  shared buff/cache available
57    Mem:  23Gi  4,3Gi 1,6Gi  118Mi      18Gi      19Gi
58    Swap: 2,0Gi 0,0Ki 2,0Gi
60    $ free -h | sed -e 's/ /!/g' -e 's/!\([^!]\)/ \1/g'
61    !!!!!!!!!!!!!! total!!!!!!! used!!!!!!! free!!!!! shared! buff/cache!! available
62    Mem:!!!!!!!!!!! 23Gi!!!!!! 4,3Gi!!!!!! 1,6Gi!!!!!! 120Mi!!!!!!! 18Gi!!!!!!! 19Gi
63    Swap:!!!!!!!!! 2,0Gi!!!!!! 0,0Ki!!!!!! 2,0Gi
65    $ free -h | sed -e 's/ /!/g' -e 's/!\([^!]\)/ \1/g' | smenu -c -S'/!/ /g'
66    ############### total        used        free        shared       buff/cache   available
67    Mem:            23Gi         4,3Gi       1,6Gi       118Mi        18Gi         19Gi
68    Swap:           2,0Gi        0,0Ki       2,0Gi
70    Where ############### is the smenu cursor.