Limit drilling down inside explore (#13293)

This PR fixes an issue with `explore` where you can "drill down" into
the same value forever. For example:

1. Run `ls | explore`
2. Press Enter to enter cursor mode
3. Press Enter again to open the selected string in a new layer
4. Press Enter again to open that string in a new layer
5. Press Enter again to open that string in a new layer
6. Repeat and eventually you have a bajillion layers open with the same
string

IMO it only makes sense to "drill down" into lists and records.

In a separate commit I also did a little refactoring, cleaning up naming
and comments.
This commit is contained in:
Reilly Wood
2024-07-05 05:18:25 -07:00
committed by GitHub
parent 1514b9fbef
commit 8707d14f95
5 changed files with 68 additions and 66 deletions

View File

@@ -65,7 +65,7 @@ impl ViewCommand for NuCmd {
let mut view = RecordView::new(columns, values);
if is_record {
view.set_orientation_current(Orientation::Left);
view.set_top_layer_orientation(Orientation::Left);
}
Ok(NuView::Records(view))

View File

@@ -58,11 +58,11 @@ impl ViewCommand for TableCmd {
let mut view = RecordView::new(columns, data);
if is_record {
view.set_orientation_current(Orientation::Left);
view.set_top_layer_orientation(Orientation::Left);
}
if let Some(o) = self.settings.orientation {
view.set_orientation_current(o);
view.set_top_layer_orientation(o);
}
if self.settings.turn_on_cursor_mode {