Skip to content

Commit d9a8ee1

Browse files
committed
[all] Add workflow files
- .code-search files are to keep track of work that is pending - scratch.rs is a file with snippets that are useful
1 parent 5e58eca commit d9a8ee1

File tree

8 files changed

+1253
-0
lines changed

8 files changed

+1253
-0
lines changed

1.code-search

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
# Query: (BUG:|REFACTOR:|PERF:|DO_NOT_COMMIT:|REVIEW:)
2+
# Flags: RegExp
3+
# ContextLines: 1
4+
5+
69 results - 34 files
6+
7+
cmdr/src/edi/state.rs:
8+
196 EditorBuffer::new_empty(&Some(&file_ext), maybe_file_path);
9+
197: // REFACTOR: [x] replace this with into_existing.rs::read_from_file()
10+
198 let content = file_utils::read_file_into_storage(maybe_file_path);
11+
12+
228
13+
229: // REFACTOR: [x] fix this
14+
230 pub fn read_file_into_storage(maybe_file_path: &Option<&str>) -> DocumentStorage {
15+
16+
core/src/common/common_result_and_error.rs:
17+
110 impl Display for CommonError {
18+
111: fn fmt(&self, f: &mut Formatter<'_>) -> Result { Debug::fmt(self, f) }
19+
112 }
20+
21+
core/src/common/ring_buffer.rs:
22+
66 #[derive(Debug, PartialEq)]
23+
67: /// REFACTOR: [ ] make a variant that is stack allocated and another that is heap allocated
24+
68 pub struct RingBuffer<T, const N: usize> {
25+
26+
core/src/decl_macros/macros.rs:
27+
90 /// use r3bl_core::call_if_true;
28+
91: /// const DEBUG: bool = true;
29+
92 /// call_if_true!(
30+
31+
core/src/misc/formatter.rs:
32+
61
33+
62: // REFACTOR: [x] replace String with StringStorage
34+
63 /// Marker trait to "remember" which types support pretty printing for debugging.
35+
36+
core/src/stack_alloc_types/into_existing.rs:
37+
228
38+
229: // REFACTOR: [ ] use this in the cmdr/src/edi/state.rs::get_content()
39+
230 pub mod read_from_file {
40+
41+
core/src/tui_core/graphemes/access.rs:
42+
177 } else {
43+
178: // PERF: [ ] perf
44+
179 chunk.into()
45+
46+
185 pub fn clip_to_range(&self, range: SelectionRange) -> &str {
47+
186: // BUG: [ ] introduce scroll adjusted type
48+
187 let SelectionRange {
49+
50+
260 // were painted in a previous render.
51+
261: // PERF: [ ] perf
52+
262 let chunk_display_width = UnicodeString::str_display_width(chunk);
53+
54+
core/src/tui_core/graphemes/convert.rs:
55+
29
56+
30: // PERF: [ ] perf
57+
31 impl<A: Array<Item = u8>> UnicodeStringExt for SmallString<A> {
58+
59+
34
60+
35: // PERF: [ ] perf
61+
36 impl<A: Array<Item = u8>> UnicodeStringExt for &SmallString<A> {
62+
63+
59
64+
60: // REFACTOR: [x] write test for all of the above!
65+
61 #[cfg(test)]
66+
67+
core/src/tui_core/graphemes/grapheme_cluster_segment.rs:
68+
25 pub struct GraphemeClusterSegment {
69+
26: // PERF: [x] perf (remove alloc)
70+
27 /// The start index (bytes), in the string slice, used to generate the [UnicodeString]
71+
72+
core/src/tui_core/graphemes/range.rs:
73+
40 #[derive(Default, Clone, PartialEq, Copy, size_of::SizeOf)]
74+
41: // BUG: [ ] introduce scroll adjusted type
75+
42 pub struct SelectionRange {
76+
77+
core/src/tui_core/graphemes/unicode_string.rs:
78+
104 pub struct UnicodeString {
79+
105: // PERF: [ ] perf
80+
106 pub string: StringStorage,
81+
82+
109 pub grapheme_cluster_segment_count: usize,
83+
110: // REFACTOR: [x] replace all usages of .display_width w/ .display_width()
84+
111 pub display_width: WidthColCount,
85+
86+
131
87+
132: // PERF: [ ] perf
88+
133 impl size_of::SizeOf for UnicodeString {
89+
90+
core/src/tui_core/tui_styled_text/tui_styled_text_impl.rs:
91+
54
92+
55: // PERF: [ ] own text, why? slice? in the past, Deserialize meant it had to own, not anymore..
93+
56 /// Use [tui_styled_text!] macro for easier construction.
94+
95+
core/src/tui_core/tui_styled_text/tui_styled_texts_impl.rs:
96+
61
97+
62: // PERF: [ ] make sure this works
98+
63 /// Use [tui_styled_texts!] macro for easier construction.
99+
100+
terminal_async/src/readline_impl/readline.rs:
101+
411
102+
412: // REFACTOR: [ ] fix this!
103+
413 let is_paused_buffer = {
104+
105+
tui/examples/demo/ex_app_no_layout/app_main.rs:
106+
538
107+
539: // REFACTOR: [ ] introduce HUD for telemetry here & copy to all other examples
108+
540
109+
110+
tui/src/tui/dialog/dialog_engine/dialog_engine_api.rs:
111+
558
112+
559: // PERF: [ ] perf
113+
560 let clipped_text = if text_display_width > max_display_col_count {
114+
115+
tui/src/tui/editor/editor_buffer/editor_buffer_struct.rs:
116+
231 pub struct EditorBufferHistory {
117+
232: // REFACTOR: [ ] consider using a "heap" allocated ring buffer for `versions`
118+
233 pub versions: sizing::VecEditorBufferHistoryVersions,
119+
120+
243 /// [EditorBuffer::get_caret] and pass it [CaretKind::ScrollAdjusted].
121+
244: // BUG: [ ] introduce scroll adjusted type
122+
245 pub caret_raw: CaretRaw,
123+
124+
453
125+
454: // REFACTOR: [ ] return struct, not tuple, add drop impl to it, to update lines_us? or drop lines_us?
126+
455: // REFACTOR: [ ] after mutations to lines, lines_us must be recomputed! consider remove this from the struct & computing it only when needed
127+
456 /// Even though this struct is mutable by editor_ops.rs, this method is provided
128+
129+
718
130+
719: // REFACTOR: [ ] add tests for sizing::MAX_UNDO_REDO_SIZE
131+
720
132+
133+
tui/src/tui/editor/editor_buffer/selection_list.rs:
134+
51 pub struct SelectionList {
135+
52: // REFACTOR: [x] consider making this a fixed size array (doesn't need to be a map which is heap allocated)
136+
53 list: VecArray<(RowIndex, SelectionRange)>,
137+
138+
120 impl SelectionList {
139+
121: // BUG: [ ] introduce scroll adjusted type
140+
122 pub fn get_caret_at_start_of_range_scroll_adjusted(
141+
142+
tui/src/tui/editor/editor_engine/editor_engine_api.rs:
143+
384 {
144+
385: // PERF: [ ] perf
145+
386 string
146+
147+
tui/src/tui/editor/editor_engine/editor_engine_internal_api.rs:
148+
298 impl SelectMode {
149+
299: // BUG: [ ] introduce scroll adjusted type
150+
300 pub fn get_caret_display_position_scroll_adjusted(
151+
152+
390
153+
391: // REFACTOR: [ ] replace the use of position and scroll offset with Caret!
154+
392 mod caret_mut {
155+
156+
403 // This is only set if select_mode is enabled.
157+
404: // BUG: [ ] introduce scroll adjusted type
158+
405 let maybe_previous_caret_display_position =
159+
160+
446 // This is only set if select_mode is enabled.
161+
447: // BUG: [ ] introduce scroll adjusted type
162+
448 let maybe_current_caret_display_position =
163+
164+
1513
165+
1514: // BUG: [ ] introduce scroll adjusted type
166+
1515: // BUG: [x] fix the cut / copy bug!
167+
1516 if let Some(new_caret_scr_adj) = maybe_new_caret {
168+
1517: // REVIEW: [ ] make sure this works (changed logic, not tested)
169+
1518 let caret_raw = new_caret_scr_adj + *buffer_mut.scr_ofs;
170+
171+
1792
172+
1793: // REVIEW: [ ] make sure this works (changed the logic, not tested)
173+
1794 let is_caret_col_overflow_content_width =
174+
175+
tui/src/tui/layout/flex_box.rs:
176+
100 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
177+
101: Debug::fmt(self, f)
178+
102 }
179+
180+
tui/src/tui/layout/layout_error.rs:
181+
53 impl Display for LayoutError {
182+
54: fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result { Debug::fmt(self, f) }
183+
55 }
184+
185+
tui/src/tui/md_parser/convert_to_plain_text.rs:
186+
190
187+
191: // REFACTOR: [x] use StringStorage here
188+
192 pub fn generate_ordered_list_item_bullet(
189+
190+
tui/src/tui/syntax_highlighting/intermediate_types.rs:
191+
342 {
192+
343: // PERF: [ ] perf
193+
344 let text = TuiStyledTexts::from(fixtures::get_list()).to_plain_text();
194+
195+
394 {
196+
395: // PERF: [ ] perf
197+
396 let text = TuiStyledTexts::from(fixtures::get_list()).to_plain_text();
198+
199+
447 {
200+
448: // PERF: [ ] perf
201+
449 let text = TuiStyledTexts::from(fixtures::get_list()).to_plain_text();
202+
203+
500 {
204+
501: // PERF: [ ] perf
205+
502 let text = TuiStyledTexts::from(fixtures::get_list()).to_plain_text();
206+
207+
553 {
208+
554: // PERF: [ ] perf
209+
555 let text = TuiStyledTexts::from(get_list_alt()).to_plain_text();
210+
211+
606 {
212+
607: // PERF: [ ] perf
213+
608 let text = TuiStyledTexts::from(get_list_alt()).to_plain_text();
214+
215+
tui/src/tui/syntax_highlighting/md_parser_syn_hi/md_parser_syn_hi_impl.rs:
216+
98 ) -> CommonResult<StyleUSSpanLines> {
217+
99: // PERF: This is a known performance bottleneck. The underlying storage mechanism for content in the editor will have to change (from Vec<String>) for this to be possible.
218+
100 // Convert the editor text into a StringStorage (unfortunately requires allocating to
219+
220+
tui/src/tui/terminal_lib_backends/offscreen_buffer.rs:
221+
115 impl Debug for OffscreenBuffer {
222+
116: // PERF: [ ] make sure this works!
223+
117 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
224+
225+
182 pub fn clear(&mut self) {
226+
183: // PERF: [ ] make this faster by keeping allocated memory?
227+
184 let current_height = self.buffer.len();
228+
229+
206 pub struct PixelCharLines {
230+
207: // PERF: [x] drop Vec and use SmallVec instead
231+
208 pub lines: VecArray<PixelCharLine>,
232+
233+
227 Self {
234+
228: // PERF: [x] drop Vec and use SmallVec instead
235+
229 lines: smallvec![
236+
237+
239 pub struct PixelCharLine {
238+
240: // PERF: [x] drop Vec and use SmallVec instead
239+
241 pub pixel_chars: VecArray<PixelChar>,
240+
241+
257 impl Debug for PixelCharLine {
242+
258: // PERF: [ ] make sure this works!
243+
259 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
244+
245+
tui/src/tui/terminal_lib_backends/paint.rs:
246+
65
247+
66: // PERF: [ ] figure out how this affects offscreen buffer memory
248+
67 let offscreen_buffer = pipeline.convert(window_size);
249+
250+
tui/src/tui/terminal_lib_backends/render_op.rs:
251+
306 /// bounds of the terminal screen.
252+
307: // PERF: [x] remove string
253+
308 PaintTextWithAttributes(StringStorage, Option<TuiStyle>),
254+
255+
315 /// padding.
256+
316: // PERF: [x] remove string
257+
317 CompositorNoClipTruncPaintTextWithAttributes(StringStorage, Option<TuiStyle>),
258+
259+
tui/src/tui/terminal_lib_backends/render_pipeline_to_offscreen_buffer.rs:
260+
76
261+
77: // PERF: [ ] figure out how this impacts OffscreenBuffer creation
262+
78 fn process_render_op(
263+
264+
tui/src/tui/terminal_lib_backends/render_tui_styled_texts.rs:
265+
26 render_ops.push(RenderOp::PaintTextWithAttributes(
266+
27: // PERF: [ ] perf
267+
28 styled_text.get_text().into(),
268+
269+
tui/src/tui/terminal_lib_backends/crossterm_backend/mod.rs:
270+
23 // Re-export.
271+
24: pub use debug::*;
272+
25 pub use offscreen_buffer_paint_impl::*;
273+
274+
tui/src/tui/terminal_lib_backends/crossterm_backend/offscreen_buffer_paint_impl.rs:
275+
227 it.push(RenderOp::CompositorNoClipTruncPaintTextWithAttributes(
276+
228: // PERF: [ ] perf
277+
229 StringStorage::from_str(text),
278+
279+
246 pub display_row_index: ChUnit,
280+
247: // PERF: [ ] remove String
281+
248 pub buffer_plain_text: StringStorage,
282+
283+
317 .push(RenderOp::CompositorNoClipTruncPaintTextWithAttributes(
284+
318: // PERF: [ ] remove String clone
285+
319 context.buffer_plain_text.clone(),
286+
287+
tui/src/tui/terminal_window/shared_global_data.rs:
288+
60 Some(ref offscreen_buffer) =>
289+
61: // PERF: [ ] make sure this pretty_print works!
290+
62 {
291+
292+
~/Downloads/tracing.rs:
293+
125
294+
126: // PERF: [ ] use this instead of [Micro/Tiny/Small/Normal/Large]StringBackingStore
295+
127 pub type StringStorage = SmallStringBackingStore;
296+
128
297+
129: // PERF: [ ] replace with StringStorage and avoid allocation using write! & index > 0 check to write \n
298+
130
299+
300+
138
301+
139: // DO_NOT_COMMIT:
302+
140 |ApplyChangeArgs {
303+
304+
155 ) -> CommonResult<StyleUSSpanLines> {
305+
156: // PERF: This is a known performance bottleneck. The underlying storage mechanism for content in the editor will have to change (from Vec<String>) for this to be possible.
306+
157 // Convert the editor text into a StringStorage (unfortunately requires allocating to

2.code-search

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Query: (NAV:|REVIEW: \\[ \\]|CS:)
2+
# Flags: CaseSensitive RegExp
3+
# ContextLines: 10
4+
5+
1 result - 1 file
6+
7+
tui/src/tui/terminal_lib_backends/paint.rs:
8+
164 window_size: Dim,
9+
165 local_data: &mut RenderOpsLocalData,
10+
166 ) -> Pos {
11+
167 let Dim {
12+
168 col_width: window_width,
13+
169 row_height: window_height,
14+
170 } = window_size;
15+
171
16+
172 let mut sanitized_abs_pos = orig_abs_pos;
17+
173
18+
174: // REVIEW: [ ] sanitize_and_save_abs_position verify correct w/ offscreen buffer process_render_op()
19+
175 sanitized_abs_pos.col_index = sanitized_abs_pos
20+
176 .col_index
21+
177 .min(window_width.convert_to_col_index());
22+
178
23+
179 sanitized_abs_pos.row_index = sanitized_abs_pos
24+
180 .row_index
25+
181 .min(window_height.convert_to_row_index());
26+
182
27+
183 // Save the cursor position to local data.
28+
184 local_data.cursor_position = sanitized_abs_pos;

3.code-search

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Query: (NAV:|REVIEW:|CS:)
2+
# Flags: CaseSensitive RegExp
3+
# ContextLines: 1
4+
5+
7 results - 7 files
6+
7+
tui/src/tui/editor/editor_engine/scroll_editor_content.rs:
8+
430 let at_bottom_of_viewport =
9+
431: // REVIEW: [x] make sure this works (equivalent changed logic, not tested)
10+
432 //
11+
12+
tui/src/tui/editor/editor_engine/validate_buffer_mut.rs:
13+
17
14+
18: // REVIEW: [x] move this out into its own module
15+
19
16+
17+
tui/src/tui/editor/editor_engine/validate_scroll_on_resize.rs:
18+
95
19+
96: // REVIEW: [ ] replace use of bool w/ enum
20+
97 match (is_caret_row_within_viewport, is_caret_row_above_viewport) {
21+
22+
tui/src/tui/terminal_lib_backends/modifier_keys_mask.rs:
23+
84 pub fn matches(&self, other: KeyModifiers) -> MatchResult {
24+
85: // REVIEW: [ ] replace use of bool w/ enum
25+
86 match (
26+
27+
tui/src/tui/terminal_lib_backends/paint.rs:
28+
173
29+
174: // REVIEW: [ ] sanitize_and_save_abs_position verify correct w/ offscreen buffer process_render_op()
30+
175 sanitized_abs_pos.col_index = sanitized_abs_pos
31+
32+
tui/src/tui/terminal_lib_backends/render_pipeline_to_offscreen_buffer.rs:
33+
990
34+
991: // REVIEW: [x] add test for sanitize_and_save_abs_position()
35+
992 #[test]
36+
37+
tui/src/tui/terminal_lib_backends/crossterm_backend/offscreen_buffer_paint_impl.rs:
38+
282 pub fn style_eq(this: &Option<TuiStyle>, other: &Option<TuiStyle>) -> bool {
39+
283: // REVIEW: [ ] replace use of bool w/ enum
40+
284 match (this.is_some(), other.is_some()) {

0 commit comments

Comments
 (0)