File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -212,12 +212,14 @@ pub const prompt = struct {
212212 while (i < input .items .len ) {
213213 const char = input .items [i ];
214214 if (char == '\t ' ) {
215- const spaces_to_add = 8 ;
215+ const tab_width = 8 ;
216+ const next_tab_stop = ((current_column / tab_width ) + 1 ) * tab_width ;
217+ const spaces_to_add = next_tab_stop - current_column ;
216218 var j : usize = 0 ;
217219 while (j < spaces_to_add ) : (j += 1 ) {
218220 _ = stdout_writer .writeByte (' ' ) catch {};
219221 }
220- current_column += spaces_to_add ;
222+ current_column = next_tab_stop ;
221223 i += 1 ;
222224 } else {
223225 const codepoint_slice = input .items [i .. ];
@@ -248,8 +250,9 @@ pub const prompt = struct {
248250 while (i < byte_index ) {
249251 const char = slice [i ];
250252 if (char == '\t ' ) {
251- // Tab stop of 8 columns
252- column += 8 ;
253+ // Align to next tab stop (multiple of 8)
254+ const tab_width = 8 ;
255+ column = ((column / tab_width ) + 1 ) * tab_width ;
253256 i += 1 ;
254257 } else {
255258 // Use the project's visible width function for other characters
You can’t perform that action at this time.
0 commit comments