sources/network/rconsession.cpp

changeset 137
485cb6d6b98c
parent 115
bb7ef7c33dad
child 138
c909c38ca886
equal deleted inserted replaced
132:8a4690db252e 137:485cb6d6b98c
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 }

mercurial