|
70 | 70 | public class LineReaderImpl implements LineReader, Flushable {
|
71 | 71 | public static final char NULL_MASK = 0;
|
72 | 72 |
|
| 73 | + /** |
| 74 | + * @deprecated use {@link #DEFAULT_TAB_WIDTH} and {@link #getTabWidth()} |
| 75 | + */ |
| 76 | + @Deprecated |
73 | 77 | public static final int TAB_WIDTH = 4;
|
74 | 78 |
|
| 79 | + public static final int DEFAULT_TAB_WIDTH = 4; |
| 80 | + |
75 | 81 | public static final String DEFAULT_WORDCHARS = "*?_-.[]~=/&;!#$%^(){}<>";
|
76 | 82 | public static final String DEFAULT_REMOVE_SUFFIX_CHARS = " \t\n;&|";
|
77 | 83 | public static final String DEFAULT_COMMENT_BEGIN = "#";
|
@@ -1111,6 +1117,10 @@ public void editAndAddInBuffer(File file) throws Exception {
|
1111 | 1117 | }
|
1112 | 1118 | }
|
1113 | 1119 |
|
| 1120 | + protected int getTabWidth() { |
| 1121 | + return getInt(LineReader.TAB_WIDTH, DEFAULT_TAB_WIDTH); |
| 1122 | + } |
| 1123 | + |
1114 | 1124 | //
|
1115 | 1125 | // Widget implementation
|
1116 | 1126 | //
|
@@ -3844,7 +3854,7 @@ protected void redisplay(boolean flush) {
|
3844 | 3854 | }
|
3845 | 3855 |
|
3846 | 3856 | if (size.getRows() > 0 && size.getRows() < MIN_ROWS) {
|
3847 |
| - AttributedStringBuilder sb = new AttributedStringBuilder().tabs(TAB_WIDTH); |
| 3857 | + AttributedStringBuilder sb = new AttributedStringBuilder().tabs(getTabWidth()); |
3848 | 3858 |
|
3849 | 3859 | sb.append(prompt);
|
3850 | 3860 | concat(getHighlightedBuffer(buf.toString()).columnSplitLength(Integer.MAX_VALUE), sb);
|
@@ -3917,7 +3927,7 @@ protected void redisplay(boolean flush) {
|
3917 | 3927 | int cursorNewLinesId = -1;
|
3918 | 3928 | int cursorColPos = -1;
|
3919 | 3929 | if (size.getColumns() > 0) {
|
3920 |
| - AttributedStringBuilder sb = new AttributedStringBuilder().tabs(TAB_WIDTH); |
| 3930 | + AttributedStringBuilder sb = new AttributedStringBuilder().tabs(getTabWidth()); |
3921 | 3931 | sb.append(prompt);
|
3922 | 3932 | String buffer = buf.upToCursor();
|
3923 | 3933 | if (maskingCallback != null) {
|
@@ -4024,7 +4034,7 @@ public AttributedString getDisplayedBufferWithPrompts(List<AttributedString> sec
|
4024 | 4034 | AttributedString attBuf = getHighlightedBuffer(buf.toString());
|
4025 | 4035 |
|
4026 | 4036 | AttributedString tNewBuf = insertSecondaryPrompts(attBuf, secondaryPrompts);
|
4027 |
| - AttributedStringBuilder full = new AttributedStringBuilder().tabs(TAB_WIDTH); |
| 4037 | + AttributedStringBuilder full = new AttributedStringBuilder().tabs(getTabWidth()); |
4028 | 4038 | full.append(prompt);
|
4029 | 4039 | full.append(tNewBuf);
|
4030 | 4040 | if (doAutosuggestion && !isTerminalDumb()) {
|
@@ -5835,7 +5845,7 @@ public boolean mouse() {
|
5835 | 5845 | List<AttributedString> secondaryPrompts = new ArrayList<>();
|
5836 | 5846 | getDisplayedBufferWithPrompts(secondaryPrompts);
|
5837 | 5847 |
|
5838 |
| - AttributedStringBuilder sb = new AttributedStringBuilder().tabs(TAB_WIDTH); |
| 5848 | + AttributedStringBuilder sb = new AttributedStringBuilder().tabs(getTabWidth()); |
5839 | 5849 | sb.append(prompt);
|
5840 | 5850 | sb.append(insertSecondaryPrompts(new AttributedString(buf.upToCursor()), secondaryPrompts, false));
|
5841 | 5851 | List<AttributedString> promptLines =
|
|
0 commit comments