aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-08-27 10:46:19 +0200
committerFredrik Gustafsson <[email protected]>2012-08-27 10:46:19 +0200
commitb57bbdb05383928505b96939df2cac81d7a6d661 (patch)
tree52182eaf4696180633763961c6f8e90fb609b3a0 /lib
parent618e0f37c9dda5bc26900692ed0cc41031be9e76 (diff)
parent5d299de9e24c79c3029e7d0d0d75bf6ebb774665 (diff)
downloadotp-b57bbdb05383928505b96939df2cac81d7a6d661.tar.gz
otp-b57bbdb05383928505b96939df2cac81d7a6d661.tar.bz2
otp-b57bbdb05383928505b96939df2cac81d7a6d661.zip
Merge branch 'pgö/escape-control-chars-tv/OTP-10218' into maint
* pgö/escape-control-chars-tv/OTP-10218: Fix Table Viewer search crash on new|changed|deleted rows Escape control characters in Table Viewer Fix Table Viewer crash after a 'Found' -> 'Not found' search sequence
Diffstat (limited to 'lib')
-rw-r--r--lib/observer/src/observer_tv_table.erl24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl
index 8fdcbf331c..8eeffb7f91 100644
--- a/lib/observer/src/observer_tv_table.erl
+++ b/lib/observer/src/observer_tv_table.erl
@@ -324,7 +324,7 @@ handle_event(#wx{id=?SEARCH_ENTRY, event=#wxCommand{type=command_text_enter,cmdS
wxStatusBar:setStatusText(SB, "Not found"),
Pid ! {mark_search_hit, Find#find.start},
wxListCtrl:refreshItem(Grid, Find#find.start),
- {noreply, State#state{search=Search#search{find=#find{found=false}}}};
+ {noreply, State#state{search=Search#search{find=Find#find{found=false}}}};
Row ->
wxListCtrl:ensureVisible(Grid, Row),
wxListCtrl:refreshItem(Grid, Row),
@@ -616,7 +616,7 @@ search([Str, Row, Dir0, CaseSens],
search(Row, Dir, Re, Table) ->
Res = try lists:nth(Row+1, Table) of
- Term ->
+ [Term|_] ->
Str = format(Term),
re:run(Str, Re)
catch _:_ -> no_more
@@ -772,7 +772,7 @@ format_tuple(_Tuple, 1, 0) ->
format_list([]) -> "[]";
format_list(List) ->
case printable_list(List) of
- true -> io_lib:format("\"~ts\"", [List]);
+ true -> io_lib:format("\"~ts\"", [map_printable_list(List)]);
false -> [$[ | make_list(List)]
end.
@@ -781,6 +781,24 @@ make_list([Last]) ->
make_list([Head|Tail]) ->
[format(Head), $,|make_list(Tail)].
+map_printable_list([$\n|Cs]) ->
+ [$\\, $n|map_printable_list(Cs)];
+map_printable_list([$\r|Cs]) ->
+ [$\\, $r|map_printable_list(Cs)];
+map_printable_list([$\t|Cs]) ->
+ [$\\, $t|map_printable_list(Cs)];
+map_printable_list([$\v|Cs]) ->
+ [$\\, $v|map_printable_list(Cs)];
+map_printable_list([$\b|Cs]) ->
+ [$\\, $b|map_printable_list(Cs)];
+map_printable_list([$\f|Cs]) ->
+ [$\\, $f|map_printable_list(Cs)];
+map_printable_list([$\e|Cs]) ->
+ [$\\, $e|map_printable_list(Cs)];
+map_printable_list([]) -> [];
+map_printable_list([C|Cs]) ->
+ [C|map_printable_list(Cs)].
+
%% printable_list([Char]) -> bool()
%% Return true if CharList is a list of printable characters, else
%% false.