TODO: Needed? Only user of isCTokenChar. Calculate where a token starts and ends, given the x-position on screen.
| 132 | //TODO: Needed? Only user of isCTokenChar. |
| 133 | /// Calculate where a token starts and ends, given the x-position on screen. |
| 134 | void Utils::calcTokenPos(const QString& s, qint32 posOnScreen, qsizetype& pos1, qsizetype& pos2) |
| 135 | { |
| 136 | qsizetype pos = std::max(0, posOnScreen); |
| 137 | if(pos >= s.length()) |
| 138 | { |
| 139 | pos1 = s.length(); |
| 140 | pos2 = s.length(); |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | pos1 = pos; |
| 145 | pos2 = pos + 1; |
| 146 | |
| 147 | if(isCTokenChar(s[pos1])) |
| 148 | { |
| 149 | while(pos1 >= 0 && isCTokenChar(s[pos1])) |
| 150 | --pos1; |
| 151 | ++pos1; |
| 152 | |
| 153 | while(pos2 < s.length() && isCTokenChar(s[pos2])) |
| 154 | ++pos2; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | QString Utils::calcHistoryLead(const QString& s) |
| 159 | { |
nothing calls this directly
no outgoing calls
no test coverage detected