198 break; |
198 break; |
199 |
199 |
200 case SVRC_TABCOMPLETE: |
200 case SVRC_TABCOMPLETE: |
201 { |
201 { |
202 StringList completes; |
202 StringList completes; |
203 |
203 completes.resize(packet.read_byte()); |
204 for (signed int i = packet.read_byte(); i > 0; --i) |
204 |
205 completes << packet.read_string(); |
205 for (String& completion : completes) |
|
206 completion = packet.read_string(); |
206 |
207 |
207 if (completes.size() == 1) |
208 if (completes.size() == 1) |
208 { |
209 { |
209 m_interface->tab_complete (m_lastTabComplete, completes[0]); |
210 m_interface->tab_complete (m_lastTabComplete, completes[0]); |
210 } |
211 } |
211 else if (not completes.is_empty()) |
212 else if (not completes.is_empty()) |
212 { |
213 { |
213 m_interface->print ("Completions for '%s':\n", m_lastTabComplete.chars()); |
214 m_interface->print ("Completions for '%s':\n", m_lastTabComplete.chars()); |
214 |
215 |
215 for (int i = 0; i < completes.size(); i += 8) |
216 for (int i : range(0, completes.size(), 8)) |
216 { |
217 { |
217 Range<int> spliceRange (i, min (i + 8, completes.size() - 1)); |
218 Range<int> spliceRange (i, min (i + 8, completes.size())); |
218 StringList splice (completes.splice (spliceRange)); |
219 StringList splice (completes.splice (spliceRange)); |
219 m_interface->print ("- %s\n", splice.join (", ").chars()); |
220 m_interface->print ("- %s\n", splice.join (", ").chars()); |
220 } |
221 } |
221 } |
222 } |
222 } |
223 } |