diff --git a/h-m-m b/h-m-m index 3d801a4..f284265 100755 --- a/h-m-m +++ b/h-m-m @@ -2084,32 +2084,13 @@ function export_html_node(&$mm, $parent_id) function export_text(&$mm) { - if (empty($mm['filename'])) - { - message($mm, "Can't export the map when it doesn't have a file name yet. Save it first."); - return; - } - - $file = fopen($mm['filename'].'.txt', "w"); - - if ($file===false) - { - message($mm, 'ERROR! Could not save the file'); - return; - } - - fwrite - ( - $file - ,implode("\n",$mm['map']) - ); - - fclose($file); - - message($mm, 'Exported as '.$mm['filename'].'.txt'); - $filename = getenv('PWD').'/'.basename($mm['filename']).'.txt'; - copy_to_clipboard($mm, $filename); + $output = ''; + foreach ($mm['map'] as $line) + if (rtrim($line) != '') + $output .= substr(rtrim($line),3)."\n"; + copy_to_clipboard($mm, $output); + message($mm, 'Exported the map to clipboard.'); } diff --git a/readme.md b/readme.md index f5376ca..418b1e8 100644 --- a/readme.md +++ b/readme.md @@ -81,7 +81,8 @@ Save, export, and quit: * `s` - saves with the previous file name (or asks for one if there's none) * `S` - saves with a new file name -* `x` - export as HTML +* `x` - export as an HTML file +* `X` - export as a text map into clipboard * `q` - quits (if the changes were already saved) * `Q` - quits, ignoring the changes