| 430 | } |
| 431 | |
| 432 | formatted_string formatted_string::chop(int length, bool pad) const |
| 433 | { |
| 434 | formatted_string result; |
| 435 | for (const fs_op& op : ops) |
| 436 | { |
| 437 | if (op.type == FSOP_TEXT) |
| 438 | { |
| 439 | result.ops.push_back(op); |
| 440 | string& new_string = result.ops[result.ops.size()-1].text; |
| 441 | int w = strwidth(new_string); |
| 442 | if (w > length) |
| 443 | new_string = chop_string(new_string, length, false); |
| 444 | length -= w; |
| 445 | if (length <= 0) |
| 446 | break; |
| 447 | } |
| 448 | else |
| 449 | result.ops.push_back(op); |
| 450 | } |
| 451 | if (pad && length > 0) |
| 452 | result += string(length, ' '); |
| 453 | |
| 454 | return result; |
| 455 | } |
| 456 | |
| 457 | formatted_string formatted_string::chop_bytes(int length) const |
| 458 | { |
no test coverage detected