1
1
/*
2
- * Copyright (c) 2002-2020 , the original author or authors.
2
+ * Copyright (c) 2002-2023 , the original author or authors.
3
3
*
4
4
* This software is distributable under the BSD license. See the terms of the
5
5
* BSD license in the documentation provided with this software.
@@ -105,7 +105,8 @@ public void aliasWidget(String orig, String alias) {
105
105
}
106
106
107
107
/**
108
- *
108
+ * Resolve widget name if its alias is given as method parameter.
109
+ * i.e. both method calls getWidget("yank") and getWidget(".yank") will return string ".yank"
109
110
* @param name widget name or alias
110
111
* @return widget name
111
112
*/
@@ -114,8 +115,8 @@ public String getWidget(String name) {
114
115
}
115
116
116
117
/**
117
- *
118
- * @param name widget name or alias
118
+ * Test if widget exists
119
+ * @param name widget name or its alias
119
120
* @return true if widget exists
120
121
*/
121
122
public boolean existsWidget (String name ) {
@@ -142,127 +143,127 @@ private Widget widget(String name) {
142
143
}
143
144
144
145
/**
145
- *
146
- * @return The LineRearer Parser
146
+ * Get lineReader's parser
147
+ * @return The parser
147
148
*/
148
149
public Parser parser () {
149
150
return reader .getParser ();
150
151
}
151
152
152
153
/**
153
- *
154
- * @return The LineReader Main KeyMap
154
+ * Get lineReader's Main KeyMap
155
+ * @return The KeyMap
155
156
*/
156
157
public KeyMap <Binding > getKeyMap () {
157
158
return reader .getKeyMaps ().get (LineReader .MAIN );
158
159
}
159
160
160
161
/**
161
- *
162
- * @return The LineReader Buffer
162
+ * Get lineReader's buffer
163
+ * @return The buffer
163
164
*/
164
165
public Buffer buffer () {
165
166
return reader .getBuffer ();
166
167
}
167
168
168
169
/**
169
- *
170
+ * Replace lineReader buffer
170
171
* @param buffer buffer that will be copied to the LineReader Buffer
171
172
*/
172
173
public void replaceBuffer (Buffer buffer ) {
173
174
reader .getBuffer ().copyFrom (buffer );
174
175
}
175
176
176
177
/**
177
- *
178
+ * Parse lineReader buffer and returns its arguments
178
179
* @return command line arguments
179
180
*/
180
181
public List <String > args () {
181
182
return reader .getParser ().parse (buffer ().toString (), 0 , ParseContext .COMPLETE ).words ();
182
183
}
183
184
184
185
/**
185
- *
186
- * @return Buffer's previous character
186
+ * Access lineReader buffer and return its previous character
187
+ * @return previous character
187
188
*/
188
189
public String prevChar () {
189
190
return String .valueOf ((char )reader .getBuffer ().prevChar ());
190
191
}
191
192
192
193
/**
193
- *
194
- * @return Buffer's current character
194
+ * Access lineReader's buffer and return its current character
195
+ * @return current character
195
196
*/
196
197
public String currChar () {
197
198
return String .valueOf ((char )reader .getBuffer ().currChar ());
198
199
}
199
200
200
201
/**
201
- *
202
- * @return LineReader's last binding
202
+ * Get lineReader's last binding
203
+ * @return last binding
203
204
*/
204
205
public String lastBinding () {
205
206
return reader .getLastBinding ();
206
207
}
207
208
208
209
/**
209
- *
210
- * @param string string to be written into LineReader Buffer
210
+ * Write the string parameter to the lineReader's buffer
211
+ * @param string string to be written
211
212
*/
212
213
public void putString (String string ) {
213
214
reader .getBuffer ().write (string );
214
215
}
215
216
216
217
/**
217
- *
218
- * @return Command line tail tip .
218
+ * Get lineReader's command hint
219
+ * @return Command hint .
219
220
*/
220
221
public String tailTip () {
221
222
return reader .getTailTip ();
222
223
}
223
224
224
225
/**
225
- *
226
- * @param tailTip tail tip to be added to the command line
226
+ * Set lineReader's command hint to be added in the command line
227
+ * @param tailTip command hint
227
228
*/
228
229
public void setTailTip (String tailTip ) {
229
230
reader .setTailTip (tailTip );
230
231
}
231
232
232
233
/**
233
- *
234
- * @param errorPattern error pattern to be set LineReader Highlighter
234
+ * Set errorPattern to the lineReader's highlighter
235
+ * @param errorPattern error pattern
235
236
*/
236
237
public void setErrorPattern (Pattern errorPattern ) {
237
238
reader .getHighlighter ().setErrorPattern (errorPattern );
238
239
}
239
240
240
241
/**
241
- *
242
- * @param errorIndex error index to be set LineReader Highlighter
242
+ * Set errorIndex to the lineReader's highlighter
243
+ * @param errorIndex error index
243
244
*/
244
245
public void setErrorIndex (int errorIndex ) {
245
246
reader .getHighlighter ().setErrorIndex (errorIndex );
246
247
}
247
248
248
249
/**
249
- * Clears command line tail tip
250
+ * Clears command line command hint
250
251
*/
251
252
public void clearTailTip () {
252
253
reader .setTailTip ("" );
253
254
}
254
255
255
256
/**
256
- *
257
- * @param type type to be set to the LineReader autosuggestion
257
+ * Set lineReader's autosuggestion type
258
+ * @param type autosuggestion type
258
259
*/
259
260
public void setSuggestionType (SuggestionType type ) {
260
261
reader .setAutosuggestion (type );
261
262
}
262
263
263
264
/**
264
- *
265
- * @param desc Text to be displayed on terminal status bar
265
+ * Add description text to the terminal status bar
266
+ * @param desc description text
266
267
*/
267
268
public void addDescription (List <AttributedString > desc ) {
268
269
Status .getStatus (reader .getTerminal ()).update (desc );
0 commit comments